#!/bin/bash
# 查询yd用户的共享内存，并提取共享内存的ID
shm_ids=$(ipcs -m | grep "yd" | awk '{print $2}')

# 如果找到共享内存，逐个删除
if [ -n "$shm_ids" ]; then
    for id in $shm_ids; do
        ipcrm -m $id
        echo "Deleted shared memory segment with ID $id"
    done
else
    echo "No shared memory segments found for user yd."
fi

    